<?php

class Adept_MessageSet
{

    protected $messages;
    
    static protected $instance = null;

    /**
     * @return Adept_MessageSet
     */
    static public function getInstance() 
    {
    	if (!isset(self::$instance)) {
    		self::$instance = new self();
    	}
    	return self::$instance;
    }
    
    public function getMessage($key, $group = '') {
        return isset($this->messages[$group][$key]) ? ($this->messages[$group][$key]) : null;
    }

    public function getMessages($group = '') {
        return isset($this->messages[$group]) ? $this->messages[$group] : array();
    }
    
    public function hasMessage($key, $group = '') 
    {
    	return isset($this->messages[$group][$key]);
    }	

    public function setMessage($key, $message, $group = '') {
        $this->messages[$group][$key] = $message;
    }

}